class Itinerary < ActiveRecord::Base
	
	belongs_to 	:trips
	
	belongs_to 	:user, :dependent => :destroy
	
	has_many	:comment, :dependent => :destroy
	has_many 	:user, 	:through => :comment
	
	has_many	:vote, :dependent => :destroy
	has_many 	:user, 	:through => :vote
	
	validates_presence_of   	:iti_location
	validates_presence_of     	:iti_start_date
	validates_presence_of     	:iti_end_date
	validates_presence_of     	:iti_image_url
	validates_presence_of     	:iti_latitude
	validates_presence_of     	:iti_longitude
	validates_presence_of     	:trip_id
	validates_presence_of     	:iti_description
	
	validates_length_of			:iti_location,    :within => 1..100
	validates_length_of			:iti_image_url,    :within => 1..250
	validates_length_of			:iti_latitude,    :within => 1..100
	validates_length_of			:iti_longitude,    :within => 1..100
	validates_length_of			:iti_description,    :within => 1..250
	validates_numericality_of	:iti_votes
	validates_numericality_of	:iti_status
	
end
